import { createRouter, createWebHashHistory } from 'vue-router'
// 导入页面
import Layout from '@/views/layout'
const Home = () => import('@/views/home')
// import Cate from '@/views/cate'
const Cate = () => import('@/views/cate')
// 导入商品详情页
const Good = () => import('@/views/good')
// 导入登录页面
const Login = () => import('@/views/login')

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        // 默认跟随父页面一起渲染显示：
        path: '/',
        component: Home
      },
      // 分类页面
      {
        path: '/cate/:id',
        component: Cate
      },
      {
        path: '/good/:id',
        component: Good
      }
    ]
  },
  {
    path: '/Login',
    component: Login
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
